<?php
namespace Sys\Controller;

use Think\Controller;

class BaseController extends Controller{
    public function _initialize(){

    }


    //权限
    protected function checkTeacherLogin(){
            $url = MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME;
            $menu = M('menus')->where(['url'=>$url])->find();

            $arrRole = explode(',',session('role'));
            if(in_array($menu['menu_id'],$arrRole)==false){
               $this->error('页面访问出错！',U('Student/index'));
            }
    }

    /*public  function teacherLogin(){
        $res=M('teachers');
        $teacher = M('teachers')->where(['mtel'=>'$res["mtel"]','pwd'=>'$res["pwd"]'])->find();
        session('tname',$teacher['tname']);
        $roles = M('roles')->where(['role_id'=>$teacher['role']])->find();
        session('roles',$roles['menu_ids']);
    }



    public  function studentsLogin(){
        $res=M('students');

        $student = M('students')->where(['mtel'=>'$res["mtel"]','pwd'=>'$res["pwd"]'])->find();
        session('sname',$student['sname']);
        $roles = M('roles')->where(['role_id'=>$student['role']])->find();
        session('roles',$roles['menu_ids']);
    }*/

}